var Api = require('../../utils/api.js');
var util = require('../../utils/util.js');
var Auth = require('../../utils/auth.js');

var wxApi = require('../../utils/wxApi.js')
var wxRequest = require('../../utils/wxRequest.js');
var app = getApp();
var webSiteName= config.getWebsiteName;
var domain =config.getDomain
import config from '../../utils/config.js'

var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    radio: 1,
    keyword:'',
    desc:1
  },

  radioChange:function(e){
    //下面的说明也要修改
    this.setData({
      radio : e.detail,
      desc :e.detail
    })
  },

  /**
   * 生命周期函数--监听页面加载1
   */
  onLoad(options) {
    var self = this;
    wx.getSystemInfo({
      success: (result) => {
        self.setData({
          windowHeight:result.windowHeight,
          windowWidth:result.windowWidth
        })
        console.log(result.inFinChat);
        if(result.inFinChat)
        {          
          self.setData({inFinChat:result.inFinChat})          
        }
        else{          
          Auth.setUserInfoData(self);
          Auth.checkLogin(self);
          self.setData({copyright: getApp().globalData.copyright})
          Auth.checkSession(self, 'isLoginNow');
        }
      },
    })

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  },
  getinputVlue:function(e){
    this.setData({
      keyword:e.detail.value
    })
  },
  searchList:function(e){
    // console.log(self.data.userInfo.user_mobile);
    // if(this.data.userInfo.user_type == 1){
    //   wx.navigateTo({
    //     url: '/pages/warrantyManageList/managelist?type='+this.data.radio+'&keyword='+this.data.keyword,
    //   })
    // }
    // else{
      wx.navigateTo({
        url: '/pages/warrantyList/list?type='+this.data.radio+'&keyword='+this.data.keyword+'&mobile='+this.data.userInfo.user_mobile+'&token='+this.data.userInfo.token,
      })
    // }  
  }
})